from selenium import webdriver
from selenium.webdriver.chrome.service import Service


class UseBrowser:
    driver=None
    def __init__(self,browser_name,path):
        if browser_name=="chrome":
            serv=Service(path)
            self.driver=webdriver.Chrome(service=serv)
            # self.driver.implicitly_wait(30)
            # self.driver.maximize_window()
            UseBrowser.driver=self.driver


        elif browser_name=="firefox":
            serv = Service(path)
            self.driver=webdriver.Firefox(service=serv)
            # self.driver.implicitly_wait(30)
            self.driver.maximize_window()
            UseBrowser.driver=self.driver


    @classmethod
    def quit(self):
        UseBrowser.driver.quit()

# if __name__=="__main__":
#     s=UseBrowser("chrome","../chromedriver")
#     time.sleep(3)
#     s.quit()

